﻿using Common;
using Linguist.Dictionary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Linguist.Flat
{
    /// <summary>
    /// Represents a word in an SentenceHMMS
    /// </summary>
    public class WordState : SentenceHMMState
    {
        /** Creates a WordState
        /// @param which*/
        public WordState(AlternativeState parent, int which) 
            :base("W", parent, which)
        {
            
        }


        /**
        /// Gets the word associated with this state
         *
        /// @return the word
         */
        public IWord getWord() 
        {
            return ((AlternativeState) getParent()).getAlternative()[getWhich()];
        }


        /**
        /// Returns a pretty name for this state
         *
        /// @return a pretty name for this state
         */
        public String getPrettyName() {
            return getName() + '(' + getWord().getSpelling() + ')';
        }


        /**
        /// Retrieves a short label describing the type of this state. Typically, subclasses of SentenceHMMState will
        /// implement this method and return a short (5 chars or less) label
         *
        /// @return the short label.
         */
        public String getTypeLabel() 
        {
            return "Word";
        }


        /**
        /// Returns the state order for this state type
         *
        /// @return the state order
         */
        override public int getOrder() {
            return 1;
        }
    }
}
